package com.panshi.modules.system.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import sun.plugin2.message.Message;

import javax.servlet.http.HttpSession;

/**
 * @author :jiege
 * @description :
 * @create :2020-08-13 09:18:00
 */
@Controller
@Api(tags = "用户退出接口")
public class SysUserCenter {

    @GetMapping("/sys/welcome.html")
    public String welcome(){
        return "/login/welcome";
    }

    @GetMapping("/logout")
    @ApiOperation("切换帐号")
    public String userloginout(HttpSession httpSession){
        // 4:创建当前登录的主体,注意;此时主体没有经过认证
        Subject subject = SecurityUtils.getSubject();
        subject.logout();//退出
        return "/login/login";
    }

    @GetMapping("/center")
    @ApiOperation("系统用户个人中心")
    public String center(){
        return "/login/center";
    }

    @GetMapping("/exit")
    @ApiOperation("退出")
    public String exit(HttpSession httpSession){
        Subject subject = SecurityUtils.getSubject();
        subject.logout();//退出
        return "/login/login";
    }

}
